home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1995 / MacHack 1995.toast / Presentations / Presentations ’92 / Graphics Acceleration Samples / Sample.r < prev   
Text File  |  1991-06-11  |  6KB  |  287 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple Sample Application
  6. #
  7. #    Sample
  8. #
  9. #    Sample.r    -    Rez Source
  10. #
  11. #    Copyright © 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    08/88
  15. #                1.01                11/88
  16. #
  17. #    Components:    Sample.p            November 1, 1988
  18. #                Sample.c            November 1, 1988
  19. #                Sample.a            November 1, 1988
  20. #                Sample.inc1.a        November 1, 1988
  21. #                SampleMisc.a        November 1, 1988
  22. #                Sample.r            November 1, 1988
  23. #                Sample.h            November 1, 1988
  24. #                [A]Sample.make        November 1, 1988
  25. #                [C]Sample.make        November 1, 1988
  26. #                [P]Sample.make        November 1, 1988
  27. #
  28. #    Sample is an example application that demonstrates how to
  29. #    initialize the commonly used toolbox managers, operate 
  30. #    successfully under MultiFinder, handle desk accessories, 
  31. #    and create, grow, and zoom windows.
  32. #
  33. #    It does not by any means demonstrate all the techniques 
  34. #    you need for a large application. In particular, Sample 
  35. #    does not cover exception handling, multiple windows/documents, 
  36. #    sophisticated memory management, printing, or undo. All of 
  37. #    these are vital parts of a normal full-sized application.
  38. #
  39. #    This application is an example of the form of a Macintosh 
  40. #    application; it is NOT a template. It is NOT intended to be 
  41. #    used as a foundation for the next world-class, best-selling, 
  42. #    600K application. A stick figure drawing of the human body may 
  43. #    be a good example of the form for a painting, but that does not 
  44. #    mean it should be used as the basis for the next Mona Lisa.
  45. #
  46. #    We recommend that you review this program or TESample before 
  47. #    beginning a new application.
  48. ------------------------------------------------------------------------------*/
  49.  
  50.  
  51. #include "Types.r"
  52.  
  53. #include "Sample.h"
  54.  
  55.  
  56. /* this is a definition for a resource which contains only a rectangle */
  57.  
  58. type 'RECT' {
  59.     rect;
  60. };
  61.  
  62.  
  63. /* we use an MBAR resource to conveniently load all the menus */
  64.  
  65. resource 'MBAR' (rMenuBar, preload) {
  66.     { mApple, mFile, mEdit, mOptions};    /* four menus */
  67. };
  68.  
  69.  
  70. resource 'MENU' (mApple, preload) {
  71.     mApple, textMenuProc,
  72.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  73.     enabled, apple,
  74.     {
  75.         "About PICTer…",
  76.             noicon, nokey, nomark, plain;
  77.         "-",
  78.             noicon, nokey, nomark, plain
  79.     }
  80. };
  81.  
  82. resource 'MENU' (mFile, preload) {
  83.     mFile, textMenuProc,
  84.     MenuItem12,                /* enable Quit only, program enables others */
  85.     enabled, "File",
  86.     {
  87.         "New",
  88.             noicon, "N", nomark, plain;
  89.         "Open",
  90.             noicon, "O", nomark, plain;
  91.         "-",
  92.             noicon, nokey, nomark, plain;
  93.         "Close",
  94.             noicon, "W", nomark, plain;
  95.         "Save",
  96.             noicon, "S", nomark, plain;
  97.         "Save As…",
  98.             noicon, nokey, nomark, plain;
  99.         "Revert",
  100.             noicon, nokey, nomark, plain;
  101.         "-",
  102.             noicon, nokey, nomark, plain;
  103.         "Page Setup…",
  104.             noicon, nokey, nomark, plain;
  105.         "Print…",
  106.             noicon, nokey, nomark, plain;
  107.         "-",
  108.             noicon, nokey, nomark, plain;
  109.         "Quit",
  110.             noicon, "Q", nomark, plain
  111.     }
  112. };
  113.  
  114. resource 'MENU' (mEdit, preload) {
  115.     mEdit, textMenuProc,
  116.     NoItems,                /* disable everything, program does the enabling */
  117.     enabled, "Edit",
  118.      {
  119.         "Undo",
  120.             noicon, "Z", nomark, plain;
  121.         "-",
  122.             noicon, nokey, nomark, plain;
  123.         "Cut",
  124.             noicon, "X", nomark, plain;
  125.         "Copy",
  126.             noicon, "C", nomark, plain;
  127.         "Paste",
  128.             noicon, "V", nomark, plain;
  129.         "Clear",
  130.             noicon, nokey, nomark, plain
  131.     }
  132. };
  133.  
  134. resource 'MENU' (mOptions, preload) {
  135.     mOptions, textMenuProc,
  136.     NoItems,                /* disable everything, program does the enabling */
  137.     enabled, "Options",
  138.      {
  139.         "Convolve",
  140.             noicon, nokey, nomark, plain
  141.     }
  142. };
  143.  
  144. /* this ALRT and DITL are used as an About screen */
  145.  
  146. /* this ALRT and DITL are used as an error screen */
  147.  
  148. resource 'ALRT' (rUserAlert, purgeable) {
  149.     {40, 20, 120, 260},
  150.     rUserAlert,
  151.     { /* array: 4 elements */
  152.         /* [1] */
  153.         OK, visible, silent,
  154.         /* [2] */
  155.         OK, visible, silent,
  156.         /* [3] */
  157.         OK, visible, silent,
  158.         /* [4] */
  159.         OK, visible, silent
  160.     }
  161. };
  162.  
  163.  
  164. resource 'DITL' (rUserAlert, purgeable) {
  165.     { /* array DITLarray: 3 elements */
  166.         /* [1] */
  167.         {50, 150, 70, 230},
  168.         Button {
  169.             enabled,
  170.             "OK"
  171.         },
  172.         /* [2] */
  173.         {10, 60, 30, 230},
  174.         StaticText {
  175.             disabled,
  176.             "PICTer - Error occurred!"
  177.         },
  178.         /* [3] */
  179.         {8, 8, 40, 40},
  180.         Icon {
  181.             disabled,
  182.             2
  183.         }
  184.     }
  185. };
  186.  
  187.  
  188. resource 'WIND' (rWindow, preload, purgeable) {
  189.     {60, 40, 290, 160},
  190.     zoomDocProc, invisible, goAway, 0x0, "PICT"
  191. };
  192.  
  193. resource 'CNTL' (rVScroll, preload, purgeable) {
  194.     {-1, 385, 236, 401},
  195.     0, visible, 0, 0, scrollBarProc, 0, ""
  196. };
  197.  
  198.  
  199. resource 'CNTL' (rHScroll, preload, purgeable) {
  200.     {235, -1, 251, 386},
  201.     0, visible, 0, 0, scrollBarProc, 0, ""
  202. };
  203.  
  204. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  205.  
  206. resource 'SIZE' (-1) {
  207.     dontSaveScreen,
  208.     acceptSuspendResumeEvents,
  209.     enableOptionSwitch,
  210.     canBackground,                /* we can background; we don't currently, but our sleep value */
  211.                                 /* guarantees we don't hog the Mac while we are in the background */
  212.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  213.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  214.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  215.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  216.     is32BitCompatible,            /* this app should not be run in 32-bit address space */
  217.     reserved,
  218.     reserved,
  219.     reserved,
  220.     reserved,
  221.     reserved,
  222.     reserved,
  223.     reserved,
  224.     kPrefSize * 1024,
  225.     kMinSize * 1024    
  226. };
  227.  
  228. data 'ICN#' (128) {
  229.     $$resource("sample.res", 'ICN#', 128)
  230. };
  231.  
  232. data 'icl8' (128) {
  233.     $$resource("sample.res", 'icl8', 128)
  234. };
  235.  
  236. data 'icl4' (128) {
  237.     $$resource("sample.res", 'icl4', 128)
  238. };
  239.  
  240. data 'ics#' (128) {
  241.     $$resource("sample.res", 'ics#', 128)
  242. };
  243.  
  244. data 'ics8' (128) {
  245.     $$resource("sample.res", 'ics8', 128)
  246. };
  247.  
  248. data 'ics4' (128) {
  249.     $$resource("sample.res", 'ics4', 128)
  250. };
  251.  
  252. data 'ALRT' (rAboutAlert, purgeable) {
  253.     $$resource("sample.res", 'ALRT', rAboutAlert)
  254. };
  255.  
  256. data 'DITL' (rAboutAlert, purgeable) {
  257.     $$resource("sample.res", 'DITL', rAboutAlert)
  258. };
  259.  
  260. data 'PICT' (rAboutAlert, purgeable) {
  261.     $$resource("sample.res", 'PICT', rAboutAlert)
  262. };
  263.  
  264.  
  265.  
  266. resource 'BNDL' (128) {
  267.     'PVWr',
  268.     0,
  269.     {
  270.         'ICN#',
  271.         {
  272.             0, 128
  273.         },
  274.         'FREF',
  275.         {
  276.             0, 128
  277.         }
  278.     }
  279. };
  280.  
  281. resource 'FREF' (128) {
  282.     'APPL',
  283.     0,
  284.     ""
  285. };
  286.  
  287.